<template>
  <view class="dialog" v-if="authType === 'mpAuthorization'">
    <u-popup :show="authType !== ''" @close="closeAuthModal" :round="38" mode="center" >
			<view class="dialog-box">
				<image class="uploadimg" :src="`${baseUrl}/uploads/uniapp_image/user/login.png`"
					mode="scaleToFill"
				/>
				<view class="dialog-title">登陆您的账户</view>
				<view class="dialog-subtitle">为了保证您可以正常使用小程序的功能，请点击去登录按钮</view>
				<button class="dialog-submit" @tap="goUrl(`/pages/public/auth/authorization_login`)">去登录</button>
			</view>
			<view class="closeModal" @tap="closeAuthModal"><u-icon name="close-circle-fill" color="#F4F4F4" size="28"></u-icon></view>
		</u-popup>
	</view>

  <view class="dialog" v-if="authType === 'authentication'">
    <u-popup :show="authType !== ''" @close="closeAuthModal" :round="38" mode="center" >
      <view class="dialog-box">
        <image class="uploadimg" :src="`${baseUrl}/uploads/uniapp_image/user/login.png`"
               mode="scaleToFill"
        />
        <view class="dialog-title">请补全您的实名信息</view>
        <view class="dialog-subtitle">为了保障您的账户安全，请尽快补全您的实名身份信息</view>
        <button class="dialog-submit" @tap="goUrl('/pages/public/auth/real_authentication')">立即认证</button>
      </view>
      <view class="closeModal" @tap="closeAuthModal"><u-icon name="close-circle-fill" color="#F4F4F4" size="28"></u-icon></view>
    </u-popup>
  </view>

  <view class="dialog" v-if="authType === 'bind_mobile'">
    <u-popup :show="authType !== ''" @close="closeAuthModal" :round="38" mode="center" >
      <view class="dialog-box">
        <image class="uploadimg" :src="`${baseUrl}/uploads/uniapp_image/user/login.png`"
               mode="scaleToFill"
        />
        <view class="dialog-title">请补全您的手机号码</view>
        <view class="dialog-subtitle">为了保障您的账户安全，请尽快绑定您的手机号码</view>
        <button class="dialog-submit" @tap="goUrl('/pages/public/auth/bind_mobile')">立即绑定</button>
      </view>
      <view class="closeModal" @tap="closeAuthModal"><u-icon name="close-circle-fill" color="#F4F4F4" size="28"></u-icon></view>
    </u-popup>
  </view>

  <view class="dialog" v-if="authType === 'entry_info'">
    <u-popup :show="authType !== ''" @close="closeAuthModal" :round="38" mode="center" >
      <view class="dialog-box">
        <image class="uploadimg" :src="`${baseUrl}/uploads/uniapp_image/user/login.png`"
               mode="scaleToFill"
        />
        <view class="dialog-title">请补全您的入职信息</view>
        <view class="dialog-subtitle">为了确保您的入职流程顺利进行并保障您在公司内的权益，请您尽快补全您的入职信息</view>
        <button class="dialog-submit" @tap="goUrl('/subpackage/user/user/entry_info')">立即填写</button>
      </view>
      <view class="closeModal" @tap="closeAuthModal"><u-icon name="close-circle-fill" color="#F4F4F4" size="28"></u-icon></view>
    </u-popup>
  </view>

</template>

<script setup>
import { computed, reactive, ref} from 'vue';
import { baseUrl } from '@/sheep/config';
import sheep from '@/sheep';
const userInfo = sheep.$store('user').userInfo;
import {
  closeAuthModal,
  showAuthModal
} from '@/sheep/hooks/useModal';
import { onLoad } from '@dcloudio/uni-app';
onLoad((options) => {
  if(options) {
    share_options = JSON.stringify(options)
  }
  
})

let share_options = {}

// 授权弹窗类型
const modalStore = sheep.$store('modal');
const authType = computed(() => modalStore.auth);
function goUrl(url) {
  closeAuthModal();
  sheep.$router.go(url, {
    share_options: share_options,
  })
}
</script>

<style scoped lang="scss">
/* //弹窗 */
.dialog{
	.dialog-box{
		height: 49%;
		width: 640rpx;
		text-align: center;
		image{
			width: 640rpx;
			height: 280rpx;
			border-radius: 64rpx 64rpx 0 0;
		}
		.dialog-title{
			padding-top: 40rpx;
			font-family: PingFangSC;
			color: $uni-text-color;
			font-weight: $uni-font-weight;
			font-size: 40rpx;
		}
		.dialog-subtitle{
			width: 80%;
			margin: 30rpx auto;
			font-family: PingFangSC;
			color: #666666;
			font-weight: 500;
			font-size: $uni-font-size-base;
			line-height: 1.5;
		}
		.dialog-submit{
			width: 400rpx;
			height: 90rpx;
			margin-bottom: 38rpx;
			font-family: PingFangSC;
			color: #FFFFFF;
			font-weight: $uni-font-weight;
			font-size: 34rpx;

			border-radius: 50rpx;
			background: linear-gradient(90deg, rgba(0, 56, 247, 1) 0%, rgba(77, 139, 255, 1) 100%);
		}
	}
}
:deep(.u-popup){
	position: relative;
	.u-icon__icon{background:transparent;}
}
.closeModal{
	margin: 0 auto;
	position: absolute;
    bottom: -120rpx;
    left: 43%;
    z-index: 99;
}
</style>